/**
 * @mbggenerated
 * @author wujian
 */
package bearworker.zxl.dao.mapper;

import bearworker.zxl.entity.ManagerPrivilege;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;

import java.util.List;

public interface ManagerPrivilegeMapper {
    /* @mbggenerated */
    @Delete({
        "delete from manager_privilege",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /* @mbggenerated */
    @Insert({
        "insert into manager_privilege (id, privi_name, ",
        "state, create_user, ",
        "create_time, upd_user, ",
        "update_time)",
        "values (#{id,jdbcType=INTEGER}, #{priviName,jdbcType=VARCHAR}, ",
        "#{state,jdbcType=TINYINT}, #{createUser,jdbcType=INTEGER}, ",
        "#{createTime,jdbcType=TIMESTAMP}, #{updUser,jdbcType=INTEGER}, ",
        "#{updateTime,jdbcType=TIMESTAMP})"
    })
    int insert(ManagerPrivilege record);

    /* @mbggenerated */
    @InsertProvider(type=ManagerPrivilegeSqlProvider.class, method="insertSelective")
    @Options(useGeneratedKeys = true,keyProperty = "manager_privilege.id")
    int insertSelective(ManagerPrivilege record);

    /* @mbggenerated */
    @Select({
        "select",
        "id, privi_name, state, create_user, create_time, upd_user, update_time",
        "from manager_privilege",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="privi_name", property="priviName", jdbcType=JdbcType.VARCHAR),
        @Result(column="state", property="state", jdbcType=JdbcType.TINYINT),
        @Result(column="create_user", property="createUser", jdbcType=JdbcType.INTEGER),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="upd_user", property="updUser", jdbcType=JdbcType.INTEGER),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP)
    })
    ManagerPrivilege selectByPrimaryKey(Integer id);

    /* @mbggenerated */
    @UpdateProvider(type=ManagerPrivilegeSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(ManagerPrivilege record);

    /* @mbggenerated */
    @Update({
        "update manager_privilege",
        "set privi_name = #{priviName,jdbcType=VARCHAR},",
          "state = #{state,jdbcType=TINYINT},",
          "create_user = #{createUser,jdbcType=INTEGER},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "upd_user = #{updUser,jdbcType=INTEGER},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(ManagerPrivilege record);

    @Select({
            "select",
            "id, privi_name, state, create_user, create_time, upd_user, update_time",
            "from manager_privilege limit #{0,jdbcType=INTEGER},#{1,jdbcType=INTEGER}"
    })
    @Results({
            @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
            @Result(column="privi_name", property="priviName", jdbcType=JdbcType.VARCHAR),
            @Result(column="state", property="state", jdbcType=JdbcType.TINYINT),
            @Result(column="create_user", property="createUser", jdbcType=JdbcType.INTEGER),
            @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
            @Result(column="upd_user", property="updUser", jdbcType=JdbcType.INTEGER),
            @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<ManagerPrivilege> selectAllPrivilege(Integer offset,Integer limit);

    @Select({
            "select",
            "count(id)",
            "from manager_privilege"
    })
    int selectPrivilegesCnt();
}